package kr.saeildamil.androidstudy_second.ani;

import kr.saeildamil.androidstudy_second.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.ViewFlipper;

public class ViewFlipperTest extends Activity {
	ViewFlipper mFlip;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch23_viewflippertest);
		
		mFlip = (ViewFlipper) findViewById(R.id.ch23_viewflipper_flip);
	}

	public void mOnClick(View v){
		switch(v.getId()){
		case R.id.ch23_viewflipper_btnprev:
			mFlip.showPrevious();
			break;
		case R.id.ch23_viewflipper_btnnext:
			mFlip.showNext();
			break;
		case R.id.ch23_viewflipper_chkflip:
			if(mFlip.isFlipping()){
				mFlip.stopFlipping();
			}else{
				mFlip.startFlipping();
			}
			break;
		case R.id.ch23_viewflipper_chkanim:
			if(mFlip.getInAnimation()==null){
				mFlip.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.viewin));
				mFlip.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.viewout));
			}else{
				mFlip.setInAnimation(null);
				mFlip.setOutAnimation(null);
			}
			break;
		}
	}
}
